
jsal.module({
    name : 'jsal.debug',
    onload : function () {
       /**
        * function jsal.debug.status
        *
        *   Get the loaded and pending modules as a text report.
        */
        jsal.debug = {};
        jsal.debug.status = function () {
            var res = '== ran\n', mod;
            for (mod in jsal.modules) {
                if (mod.ran) continue;
                res += '- ' + mod + '\n';
            }
            res += '\n== waiting for dependencies\n';
            for (mod in jsal.modules) {
                if (! mod.ran) continue;
                res += '- ' + mod + '\n';
            }
            res += '\n== not loaded\n';
            for (mod in jsal.scriptElements) {
                res += '- ' + mod + ' from ' + jsal.scriptElements[mod][0].src + '\n';
            }
            res += '\n== module hooks\n';
            for (var ident in jsal.onLoadModules) {
                res += jsal.onLoadModules[ident][0].join(',') + ' - ' + jsal.onLoadModules[ident][1] + '\n';
            }
            return res;
        };
    }
});

